package cn.echoedu.control;

import java.sql.SQLException;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.echoedu.command.base.SuccessParam;
import cn.echoedu.entity.TelContacts;
import cn.echoedu.entity.receivecommand.ContactsListReceive;

public class TelContactsControl extends BaseControl{
	public final int CONTACTS_LIST=0;//办公
	public final int CONTACTS_CLASS=1;//班友
	public final int CONTACTS__MAKE_FRIEND=2;//校友
	public final int HOT_CONTACTS_LIST=3;//热门
	
	
	public void doHotContactsList(HttpServletRequest request,
			HttpServletResponse response, ContactsListReceive contactlistrec,int type) 
					throws SQLException {
		// TODO Auto-generated method stub
		List<TelContacts> telcontactslist = null;
	
			telcontactslist=getTelContactsModel().
			queryByLeftJoinAndCommand(contactlistrec.getCommand(),"",contactlistrec.getSchool_code()
					,contactlistrec.getDepartmentcode(),contactlistrec.getClasscode(),contactlistrec.getCode());
		SuccessParam successparam = new SuccessParam();
		successparam.setRequest(request);
		successparam.setResponse(response);
		successparam.setParam(telcontactslist);
		successparam.setToken(contactlistrec.getToken());
		switch (type){
		case CONTACTS_LIST:
			getResponseService().doContactsList(successparam);
			break;
		case CONTACTS_CLASS:
			getResponseService().doContactsClass(successparam);
			break;
		case CONTACTS__MAKE_FRIEND:
			getResponseService().doContactsMakeFriend(successparam);
			break;
		case HOT_CONTACTS_LIST:
			getResponseService().doHotContactsList(successparam);
			break;
		default:

		}
	}
}
